﻿<UserControl
    x:Class="Srk.BetaseriesApiApp.Views.ShowSearch"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" 
    xmlns:ctrls="clr-namespace:Srk.BetaseriesApiApp.Controls"
    d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <WrapPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
            <TextBox Text="{Binding SearchString, UpdateSourceTrigger=PropertyChanged}"
                                 Width="240" Margin="8,4,8,4" />
            <Button Command="{Binding SearchCommand}"
                                IsDefault="True" Margin="8,4,8,4" Content="Go"/>
        </WrapPanel>

        <WrapPanel Grid.Row="0" Grid.Column="1"/>

        <ListView Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" Margin="4"
                              ItemsSource="{Binding Shows}" x:Name="lvSearchShows"
                              SelectedItem="{Binding SelectedShow}"
                              MouseDoubleClick="shows_MouseDoubleClick"
                              ScrollViewer.CanContentScroll="True">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Title}" />
                </GridView>
            </ListView.View>
            <ListView.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Episodes" x:Name="showMenu_Episodes" Click="showMenu_Episodes_Click" />
                    <MenuItem Header="Comments" x:Name="showMenu_Comments" Click="showMenu_Comments_Click" />
                </ContextMenu>
            </ListView.ContextMenu>
        </ListView>

        <!--<GridSplitter Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="4"
                                  ResizeDirection="Rows"
                                  Height="4" HorizontalAlignment="Stretch"
                                  Background="Gray" />-->

        <ctrls:ShowControl DataContext="{Binding SelectedShow}"
                                       Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="4" />

        <TextBlock Grid.Row="4" Grid.ColumnSpan="2" Text="{Binding StatusMessage}" Margin="4" />
    </Grid>
</UserControl>
